<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::group(['prefix' => 'no-permissions', 'namespace' => 'Backstage'], function () {
    Route::get('/', ['uses' => 'PermissionsController@getNoPermissions']);
});

Route::group(['middleware' => ['auth','permissions.check'], 'namespace' => 'Backstage', 'prefix' => 'backstage'], function () {

    Route::group(['prefix' => 'home'], function () {
        Route::get('/', ['uses' => 'HomeController@getIndex', 'as' => 'get.home.index']);
        Route::get('t1', ['uses' => 'HomeController@getT1']);
    });

    Route::group(['prefix' => 'coupons'], function () {
        Route::get('addcoupons', ['uses'                 => 'CouponsController@getAddcoupons', 'as' => 'get.coupons.couponslist.addcoupons']);
        Route::post('addcoupons', ['uses'                => 'CouponsController@postAddcoupons','as' => 'post.coupons.couponslist.addcoupons']);
        Route::post('check-channel-name', ['uses'        => 'CouponsController@postCheckChannelName','as' => 'post.coupons.couponslist.check-channel-name']);
        Route::post('check-channel-id', ['uses'          => 'CouponsController@postCheckChannelId','as' => 'post.coupons.couponslist.check-channel-id']);
        Route::get('get-use-range', ['uses'              => 'CouponsController@getGetUseRange','as' => 'get.coupons.couponslist.get-use-range']);
        Route::post('coupon-update', ['uses'             => 'CouponsController@postCouponUpdate','as' => 'post.coupons.couponslist.coupon-update']);

        Route::get('couponslist', ['uses'                => 'CouponsController@getCouponslist','as' => 'get.coupons.couponslist']);

        Route::get('coupon-binding-couponlist', ['uses'  => 'CouponsController@getCouponBindingCouponlist','as' => 'get.coupons.couponslist.coupon-binding-couponlist']);
        Route::get('binding-ch-ids-step1', ['uses'       => 'CouponsController@getBindingChIdsStep1','as' => 'get.coupons.couponslist.binding-ch-ids-step1']);

        Route::post('binding-ch-ids-step1', ['uses'      => 'CouponsController@postBindingChIdsStep1','as' => 'post.coupons.couponslist.binding-ch-ids-step1']);
        Route::post('binding-ch-ids-step2', ['uses'      => 'CouponsController@postBindingChIdsStep2','as' => 'post.coupons.couponslist.binding-ch-ids-step2']);
        Route::get('binding-coupons', ['uses'            => 'CouponsController@getBindingCoupons','as' => 'get.coupons.couponslist.binding-coupons']);
        Route::post('binding-coupons', ['uses'           => 'CouponsController@postBindingCoupons','as' => 'post.coupons.couponslist.binding-coupons']);
        Route::get('checkchannelid', ['uses'             => 'CouponsController@getCheckchannelid','as' => 'get.coupons.couponslist.checkchannelid']);
        Route::get('issuing', ['uses'                    => 'CouponsController@getIssuing','as' => 'get.coupons.couponslist.issuing']);
        Route::get('generatexls', ['uses'                => 'CouponsController@getGeneratexls','as' => 'get.coupons.couponslist.generatexls']);
        Route::get('detail', ['uses'                     => 'CouponsController@getDetail','as' => 'get.coupons.couponslist.detail']);

        Route::post('delete', ['uses'                    => 'CouponsController@postDelete','as' => 'post.coupons.couponslist.delete']);

        Route::post('channel-res-delete', ['uses'        => 'CouponsController@postChannelResDelete','as' => 'post.coupons.couponslist.channel-res-delete']);
        Route::post('channel-res-update-quota', ['uses'  => 'CouponsController@postChannelResUpdateQuota','as' => 'post.coupons.couponslist.channel-res-update-quota']);
        Route::post('coupons-search', ['uses'            => 'CouponsController@postCouponsSearch','as' => 'post.coupons.couponslist.coupons-search']);
        Route::post('res-search', ['uses'                => 'CouponsController@postResSearch','as' => 'post.coupons.couponslist.res-search']);
        Route::post('add-use-range', ['uses'             => 'CouponsController@postAddUseRange','as' => 'post.coupons.couponslist.add-use-range']);
        Route::get('channel-use-range', ['uses'          => 'CouponsController@getChannelUseRange','as' => 'get.coupons.couponslist.channel-use-range']);
        Route::get('channel-use-range-details', ['uses'  => 'CouponsController@getChannelUseRangeDetails','as' => 'get.coupons.couponslist.channel-use-range-details']);
        Route::post('channel-use-range-details', ['uses' => 'CouponsController@postChannelUseRangeDetails','as' => 'post.coupons.couponslist.channel-use-range-details']);
        Route::post('update-stock', ['uses'              => 'CouponsController@postUpdateStock','as' => 'post.coupons.couponslist.update-stock']);
        Route::post('coupons-qr-img', ['uses'            => 'CouponsController@postCouponsQrImg','as' => 'post.coupons.couponslist.coupons-qr-img']);
        Route::post('add-channel-map',['uses'            => 'CouponsController@addChannelMap','as' => 'post.coupons.couponslist.add-channel-map']);
        Route::post('coupon-to-user', ['uses' => 'CouponsController@couponToUser', 'as' => 'get.coupons.coupontouserview.coupon-to-user']);
        Route::get('coupon-to-user',['uses' => 'CouponsController@couponToUserView', 'as' => 'get.coupons.coupontouserview']);
        Route::get('coupon-list-channel',['uses' => 'CouponsController@couponListFromChannel', 'as' => 'get.coupons.couponslist.coupon-list-channel']);
    });
    Route::group(['prefix' => 'income'], function () {
        Route::get('apply-withdraw-list',['uses' =>'IncomeController@applyWithdrawList','as'=>'get.income.apply-withdraw-list']);
        Route::get('user-apply-withdraw',['uses' =>'IncomeController@userApplyWithdraw','as'=>'get.income.apply-withdraw-list.user-apply-withdraw']);
        Route::post('transfer-accounts',['uses'  =>'IncomeController@transferAccounts','as'=>'post.income.apply-withdraw-list.transfer-accounts']);
        Route::post('cancel',['uses' =>'IncomeController@cancel','as'=>'post.income.apply-withdraw-list.cancel']);

    });

    Route::group(['prefix' => 'order'], function () {
        Route::get('order-config-list',['uses'          => 'OrderConfigController@orderConfigList',
                                        'as'            =>'get.order.order-config-list']);
        Route::post('upd-order-config',['uses'          => 'OrderConfigController@updateOrderConfig',
                                        'as'            =>'post.order.order-config-list.upd-order-config']);
        Route::get('order-list', ['uses'                => 'OrderController@orderList',
                                  'as'                  =>'get.order.order-list']);

        Route::get('order-detail',['uses'               => 'OrderController@orderDetail',
            'as'=>'get.order.order-list.order-detail']);
        Route::post('order-send',['uses'                => 'OrderController@orderSend','as'=>'post.order.order-list.order-send']);
        Route::post('order-confirm',['uses'             => 'OrderController@orderConfirm', 'as' => 'post.order.order-list.order-confirm']);
        Route::post('update-order-back-message',['uses' => 'OrderController@updateOrderBackMessage','as'=>'post.order.order-list.update-order-back-message']);
        Route::post('create-order-zip',['uses'          => 'OrderController@createOrderZip','as'=>'post.order.order-list.create-order-zip']);
        Route::post('update-order-rece',['uses'         => 'OrderController@updateOrderRece','as'=>'post.order.order-list.update-order-rece']);
        Route::get('create-excel',['uses'               => 'OrderController@createExcel', 'as'=> 'get.order.order-list.create-excel']);
        Route::post('update-order-print-state',['uses'  => 'OrderController@updateOrderPrintState', 'as' => 'post.order.order-list.update-order-print-state']);
        Route::get('aftermark-list',['uses'             => 'OrderController@aftermarkList','as' => 'get.order.aftermark-list']);
        Route::get('after-detail',['uses'               => 'OrderController@aftermarkDetail','as' => 'get.order.aftermark-list.after-detail']);
        Route::post('update-aftermark-state',['uses'    => 'OrderController@updateAfterState','as' => 'post.order.aftermark-list.update-aftermark-state']);
        Route::post('update-result-desc',['uses'        => 'OrderController@updateResultDesc','as' => 'post.order.order-list.update-result-desc']);
        Route::post('system-resend-express',['uses'     => 'OrderController@systemResendExpress','as' => 'post.order.order-list.system-resend-express']);
        Route::post('update-aftermark-back-remark',['uses' => 'OrderController@updateAftermarkBackRemark','as' => 'post.order.aftermark-list.update-aftermark-back-remark']);
        Route::post('create-after-zip',['uses'          => 'OrderController@createAfterZip', 'as' => 'post.order.aftermark-list.create-after-zip']);
        Route::post('close-worksheet',['uses'           => 'OrderController@closeWorksheet', 'as' => 'post.order.order-list.close-worksheet']);
        Route::get('create-order-page',['uses'          => 'OrderController@createOrderPage', 'as' => 'get.order.create-order-page']);
        Route::post('get-product-info',['uses'          => 'OrderController@getProductInfo', 'as' => 'post.order.create-order-page.get-product-info']);
        Route::post('find-size',['uses'                 => 'OrderController@findSize', 'as' => 'post.order.create-order-page.find-size']);
        Route::post('create-order',['uses'              => 'OrderController@createOrder', 'as' => 'post.order.create-order-page.create-order']);
        Route::get('order-cancel-blade',['uses'         => 'OrderController@order_cancel_blade', 'as' => 'get.order.order-list.order-cancel-blade']);
        Route::post('order-cancel',['uses'              => 'OrderController@order_cancel', 'as' => 'post.order.order-list.order-cancel']);
        Route::get('show-alirefund',['uses'             => 'OrderController@show_alirefund', 'as' => 'get.order.order-list.show-alirefund']);
        Route::post('alirefund',['uses'                 => 'OrderController@alirefund', 'as' => 'post.order.order-list.alirefund']);
        Route::post('order-statistics',['uses'          => 'OrderController@order_statistics', 'as' => 'post.order.order-list.order-statistics']);
        Route::get('statistics',['uses'                 => 'OrderController@statistics','as' => 'get.order.statistics']);
        Route::get('test',['uses'                       => 'OrderController@test','as' => 'get.order.test']);
    });

    Route::group(['prefix' => 'express'], function () {
        Route::get('list',['uses' => 'ExpressController@getList','as'=>'get.express.list']);
        Route::post('delete',['uses' => 'ExpressController@postDelete','as'=>'post.express.list.delete']);
        Route::post('add',['uses' => 'ExpressController@postAdd','as'=>'post.express.list.add']);
    });
    Route::group(['prefix' => 'config'], function (){
        Route::get('android-version-list',['uses' => 'AndroidController@getAndroidVersionList','as' => 'get.config.android-version-list']);
        Route::get('new-android-version',['uses'  => 'AndroidController@newAndroidVersion', 'as' => 'get.config.android-version-list.new-android-version']);
        Route::post('insert-android-version',['uses' => 'AndroidController@insertAndroidVersion', 'as' => 'post.config.android-version-list.insert-android-version']);
        Route::post('delete-android-version',['uses' => 'AndroidController@deleteAndroidVersion', 'as' => 'post.config.android-version-list.delete-android-version']);
        Route::get('api-configs',['uses' => 'ConfigController@apiConfig', 'as' => 'get.config.api-configs']);
        Route::post('update-api-config',['uses' => 'ConfigController@updateApiCongfig', 'as' => 'post.config.api-configs.update-api-config']);
    });
    Route::group(['prefix' => 'other'], function () {
        Route::get('feed-back',['uses' => 'OtherController@feed_back_list','as'=>'get.other.list']);
    });
});



/**
 * 认证用户后台无authentication中间件
 */
Route::group(['middleware' => ['csrf'], 'prefix' => 'authentication', 'namespace' => 'Front'], function () {
    Route::get('login', ['uses' => 'AuthController@loginIndex']);
    Route::post('send-captcha', ['uses' => 'AuthController@sendCaptcha']);
    Route::post('login', ['uses' => 'AuthController@login']);
});
/**
 * 认证用户后台有authentication中间件
 */
Route::group(['middleware' => ['csrf', 'authentication.auth'], 'prefix' => 'authentication', 'namespace' => 'Front'], function () {
    Route::get('person', ['uses'                     => 'AuthController@person']);
    Route::get('home', ['uses'                       => 'AuthController@home']);
    Route::get('logout', ['uses'                     => 'AuthController@logout']);
    Route::get('withdraw-deposit', ['uses'           => 'WithdrawDepositController@withdrawDeposit']);
    Route::get('withdraw-deposit-operation', ['uses' => 'WithdrawDepositController@withdrawDepositOperation']);

});

Route::group(['prefix' => 'auth'], function ($route) {
    Auth::routes();
});
